package com.luculent.utils.excelfile;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.luculent.excel.util.ExcelUtil;
import com.luculent.utils.excelfile.model.Education;
import com.luculent.utils.excelfile.model.Industry;
import com.luculent.utils.excelfile.model.Leader;
import com.luculent.utils.excelfile.model.Medical;
import com.luculent.utils.excelfile.model.Member;
import com.luculent.utils.excelfile.model.PoorFamily;
import com.luculent.utils.excelfile.model.Worker;
import com.luculent.utils.util.UuidUtil;

/**
 * GetExcelData 获取execl数据
 * @author ShiQiang
 *
 */
public class GetExcelData {
	//图片文件中位置坐标  页   行  列
	private static String imgKey1 = "0_7_0";
	private static String imgKey2 = "0_7_3";
	private static String imgKey3 = "0_7_6";
	private static String imgKey4 = "0_14_0";
	private static String imgKey5 = "0_14_3";
	private static String imgKey6 = "0_14_6";
	private static String imgKey7 = "0_27_4";
	private static String imgKey8 = "0_27_6";
	private static String imgKey9 = "0_43_0";
	private static String imgKey10 = "0_43_3";
	private static String imgKey11 = "0_43_6";
	//返回sql对应的key
	private static String FAMILY = "FAMILY";
	private static String MEMBERONE = "MEMBERONE";
	private static String MEMBERTWO = "MEMBERTWO";
	private static String MEMBERTHREE = "MEMBERTHREE";
	private static String MEMBERFOUR = "MEMBERFOUR";
	private static String MEMBERFIVE = "MEMBERFIVE";
	private static String MEMBERSIX = "MEMBERSIX";
	private static String EDUCATIONONE = "EDUCATIONONE";
	private static String EDUCATIONTWO = "EDUCATIONTWO";
	private static String EDUCATIONTHREE = "EDUCATIONTHREE"; 
	private static String WORKERONE = "WORKERONE";
	private static String WORKERTWO = "WORKERTWO"; 
	private static String MEDICALONE = "MEDICALONE";
	private static String MEDICALTWO = "MEDICALTWO";
	private static String MEDICALTHREE = "MEDICALTHREE";
	private static String LEADERONE = "LEADERONE";
	private static String LEADERTWO = "LEADERTWO";
	private static String LEADERTHREE = "LEADERTHREE";
	
	private static String INDUSTRYONE = "INDUSTRYONE";
	private static String INDUSTRYTWO = "INDUSTRYTWO";
	private static String INDUSTRYTHREE = "INDUSTRYTHREE";
	private static String INDUSTRYFOUR = "INDUSTRYFOUR";
	
	
	public static Map<String,String> getInfo(String filePath,Map<String,String> fileNames,String xian,String xiang,String cun) throws Exception { 
		Map<String,String> sql = new HashMap<String,String>();
		File file = new File(filePath);  
        InputStream input = new FileInputStream(file);  
		List<List<Object>> list = ExcelUtil.readExcel(input, 0); 
		
		
		
//		for (int i = 0; i < list.size(); i++) { 
//			List<Object> rows = list.get(i);  
//			for (int j = 0; j < rows.size(); j++) {
//				Object cellValue = rows.get(j); 
//				log.debug("行："+i+"列："+j+"值："+cellValue);
//			} 
//		}
		 
		
		
		
		
		PoorFamily poorFamliy = new PoorFamily();
		String poorId = UuidUtil.get32UUID();
		poorFamliy.setId(poorId);
		poorFamliy.setTitle(list.get(0).get(0)==null?"":list.get(0).get(0).toString().replace(" ", ""));
		String address = list.get(1).get(0)==null?"":list.get(1).get(0).toString();
		poorFamliy.setAddress(address);
		address = address.replaceAll("  +",",");  
		String[] sddrs = address.split(",");
		if(sddrs !=null && sddrs.length > 0){
			poorFamliy.setXiang(sddrs[1].split("：")[1]);
			poorFamliy.setXzcun(sddrs[2]);
			poorFamliy.setZrcun(sddrs[3]);
			String endDoor = "";
			for(int i=4;i<sddrs.length;i++){
				endDoor +=sddrs[i].trim();
			}
			poorFamliy.setDoorNum(endDoor); 
		}  
		poorFamliy.setHouseholderName(list.get(3).get(0)==null?"":list.get(3).get(0).toString().replace(" ", ""));
		poorFamliy.setMobile(list.get(3).get(1)==null?"":list.get(3).get(1).toString().replace(" ", ""));
		poorFamliy.setFamilyCount(list.get(3).get(2)==null?"":list.get(3).get(2).toString().replace(" ", ""));
		poorFamliy.setPolitical(list.get(3).get(3)==null?"":list.get(3).get(3).toString().replace(" ", ""));
		poorFamliy.setWorkCount(list.get(3).get(4)==null?"":list.get(3).get(4).toString().replace(" ", ""));
		poorFamliy.setPoorReason(list.get(3).get(5)==null?"":list.get(3).get(5).toString().replace(" ", ""));
		poorFamliy.setRecognitionYear(list.get(3).get(6)==null?"":list.get(3).get(6).toString().replace(" ", ""));
		poorFamliy.setLeavePoorYear(list.get(3).get(7)==null?"":list.get(3).get(7).toString().replace(" ", ""));
		poorFamliy.setPoorType(list.get(3).get(8)==null?"":list.get(3).get(8).toString().replace(" ", ""));
		poorFamliy.setLowHousehold(list.get(5).get(0)==null?"":list.get(5).get(0).toString().replace(" ", ""));
		poorFamliy.setLowLevel(list.get(5).get(1)==null?"":list.get(5).get(1).toString().replace(" ", ""));
		poorFamliy.setLowAmount(list.get(5).get(2)==null?"":list.get(5).get(2).toString().replace(" ", ""));
		poorFamliy.setFarmlandArea(list.get(5).get(3)==null?"":list.get(5).get(3).toString().replace(" ", ""));
		poorFamliy.setWaterLandArea(list.get(5).get(4)==null?"":list.get(5).get(4).toString().replace(" ", ""));
		poorFamliy.setFeaturePlant(list.get(5).get(5)==null?"":list.get(5).get(5).toString().replace(" ", ""));
		poorFamliy.setJoinTogether(list.get(5).get(6)==null?"":list.get(5).get(6).toString().replace(" ", ""));
		poorFamliy.setIncome(list.get(5).get(7)==null?"":list.get(5).get(7).toString().replace(" ", ""));
		poorFamliy.setAvgIncome(list.get(5).get(8)==null?"":list.get(5).get(8).toString().replace(" ", ""));
		
		
		if(list.get(8).get(2)!=null){
			Member member1 = new Member();
			member1.setfId(poorId);
			member1.setCoordinate("1");
			String name = list.get(12).get(0).toString().replace(" ", "");
			if(name.indexOf("姓名：") >= 0 && name.split("：").length > 1){
				member1.setName(name.split("：")[1]);
			}else{
				member1.setName("");
			}
			
			String age = list.get(13).get(0)==null?"":list.get(13).get(0).toString().replace(" ", "");
			if(age.indexOf("年龄：") >= 0 && age.split("：").length > 1){
				member1.setAge(age.split("：")[1]);
			}else{
				member1.setAge("");
			}
			
			member1.setSex(list.get(7).get(2)==null?"":list.get(7).get(2).toString().replace(" ", ""));
			member1.setIdNo(list.get(8).get(2)==null?"":list.get(8).get(2).toString().replace(" ", ""));
			member1.setRelationsh(list.get(9).get(2)==null?"":list.get(9).get(2).toString().replace(" ", ""));
			member1.setNation(list.get(10).get(2)==null?"":list.get(10).get(2).toString().replace(" ", ""));
			member1.setCulture(list.get(11).get(2)==null?"":list.get(11).get(2).toString().replace(" ", ""));
			member1.setStudent(list.get(12).get(2)==null?"":list.get(12).get(2).toString().replace(" ", ""));
			member1.setHealth(list.get(13).get(2)==null?"":list.get(13).get(2).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey1)){
				if(StringUtils.isBlank(fileNames.get(imgKey1))){
					member1.setImg("");
				}else{
					member1.setImg(fileNames.get(imgKey1));
				}
				
			} 
			sql.put(MEMBERONE, member1.toString());
		}
		if(list.get(8).get(5)!=null){
			Member member = new Member();
			member.setfId(poorId);
			member.setCoordinate("2"); 
			String name = list.get(12).get(3).toString().replace(" ", "");
			if(name.indexOf("姓名：") >= 0  && name.split("：").length > 1){
				member.setName(name.split("：")[1]);
			}else{
				member.setName("");
			}  
			String age = list.get(13).get(3)==null?"":list.get(13).get(3).toString().replace(" ", "");
			if(age.indexOf("年龄：") >= 0  && age.split("：").length > 1){
				member.setAge(age.split("：")[1]);
			}else{
				member.setAge("");
			}
			member.setSex(list.get(7).get(5)==null?"":list.get(7).get(5).toString().replace(" ", ""));
			member.setIdNo(list.get(8).get(5)==null?"":list.get(8).get(5).toString().replace(" ", ""));
			member.setRelationsh(list.get(9).get(5)==null?"":list.get(9).get(5).toString().replace(" ", ""));
			member.setNation(list.get(10).get(5)==null?"":list.get(10).get(5).toString().replace(" ", ""));
			member.setCulture(list.get(11).get(5)==null?"":list.get(11).get(5).toString().replace(" ", ""));
			member.setStudent(list.get(12).get(5)==null?"":list.get(12).get(5).toString().replace(" ", ""));
			member.setHealth(list.get(13).get(5)==null?"":list.get(13).get(5).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey2)){
				if(StringUtils.isBlank(fileNames.get(imgKey2))){
					member.setImg("");
				}else{
					member.setImg(fileNames.get(imgKey2));
				}
				
			}
			sql.put(MEMBERTWO, member.toString());
		}
		if(list.get(8).get(8)!=null){
			Member member = new Member();
			member.setfId(poorId);
			member.setCoordinate("3"); 
			String name = list.get(12).get(6).toString().replace(" ", "");
			if(name.indexOf("姓名：") >= 0  && name.split("：").length > 1){
				member.setName(name.split("：")[1]);
			}else{
				member.setName("");
			} 
			 
			String age = list.get(13).get(6)==null?"":list.get(13).get(6).toString().replace(" ", "");
			if(age.indexOf("年龄：") >= 0  && age.split("：").length > 1){
				member.setAge(age.split("：")[1]);
			}else{
				member.setAge("");
			}
			member.setSex(list.get(7).get(8)==null?"":list.get(7).get(8).toString().replace(" ", ""));
			member.setIdNo(list.get(8).get(8)==null?"":list.get(8).get(8).toString().replace(" ", ""));
			member.setRelationsh(list.get(9).get(8)==null?"":list.get(9).get(8).toString().replace(" ", ""));
			member.setNation(list.get(10).get(8)==null?"":list.get(10).get(8).toString().replace(" ", ""));
			member.setCulture(list.get(11).get(8)==null?"":list.get(11).get(8).toString().replace(" ", ""));
			member.setStudent(list.get(12).get(8)==null?"":list.get(12).get(8).toString().replace(" ", ""));
			member.setHealth(list.get(13).get(8)==null?"":list.get(13).get(8).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey3)){
				if(StringUtils.isBlank(fileNames.get(imgKey3))){
					member.setImg("");
				}else{
					member.setImg(fileNames.get(imgKey3));
				} 
			}
			sql.put(MEMBERTHREE, member.toString());
		}
		if(list.get(15).get(2)!=null){
			Member member = new Member();
			member.setfId(poorId);
			member.setCoordinate("4");
			String name = list.get(19).get(0).toString().replace(" ", "");
			if(name.indexOf("姓名：") >= 0  && name.split("：").length > 1){
				member.setName(name.split("：")[1]);
			}else{
				member.setName("");
			} 
		 
			String age = list.get(20).get(0)==null?"":list.get(20).get(0).toString().replace(" ", "");
			if(age.indexOf("年龄：") >= 0  && age.split("：").length > 1){
				member.setAge(age.split("：")[1]);
			}else{
				member.setAge("");
			} 
			member.setSex(list.get(14).get(2)==null?"":list.get(14).get(2).toString().replace(" ", ""));
			member.setIdNo(list.get(15).get(2)==null?"":list.get(15).get(2).toString().replace(" ", ""));
			member.setRelationsh(list.get(16).get(2)==null?"":list.get(16).get(2).toString().replace(" ", ""));
			member.setNation(list.get(17).get(2)==null?"":list.get(17).get(2).toString().replace(" ", ""));
			member.setCulture(list.get(18).get(2)==null?"":list.get(18).get(2).toString().replace(" ", ""));
			member.setStudent(list.get(19).get(2)==null?"":list.get(19).get(2).toString().replace(" ", ""));
			member.setHealth(list.get(20).get(2)==null?"":list.get(20).get(2).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey4)){
				if(StringUtils.isBlank(fileNames.get(imgKey4))){
					member.setImg("");
				}else{
					member.setImg(fileNames.get(imgKey4));
				} 
			}
			sql.put(MEMBERFOUR, member.toString());
		}
		if(list.get(15).get(5)!=null){
			Member member = new Member();
			member.setfId(poorId);
			member.setCoordinate("5"); 
			String name = list.get(19).get(3).toString().replace(" ", "");
			if(name.indexOf("姓名：") >= 0  && name.split("：").length > 1){
				member.setName(name.split("：")[1]);
			}else{
				member.setName("");
			} 
			 
			String age = list.get(20).get(3)==null?"":list.get(20).get(3).toString().replace(" ", "");
			if(age.indexOf("年龄：") >= 0  && age.split("：").length > 1){
				member.setAge(age.split("：")[1]);
			}else{
				member.setAge("");
			} 
			member.setSex(list.get(14).get(5)==null?"":list.get(14).get(5).toString().replace(" ", ""));
			member.setIdNo(list.get(15).get(5)==null?"":list.get(15).get(5).toString().replace(" ", ""));
			member.setRelationsh(list.get(16).get(5)==null?"":list.get(16).get(5).toString().replace(" ", ""));
			member.setNation(list.get(17).get(5)==null?"":list.get(17).get(5).toString().replace(" ", ""));
			member.setCulture(list.get(18).get(5)==null?"":list.get(18).get(5).toString().replace(" ", ""));
			member.setStudent(list.get(19).get(5)==null?"":list.get(19).get(5).toString().replace(" ", ""));
			member.setHealth(list.get(20).get(5)==null?"":list.get(20).get(5).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey5)){
				if(StringUtils.isBlank(fileNames.get(imgKey5))){
					member.setImg("");
				}else{
					member.setImg(fileNames.get(imgKey5));
				}  
			}
			sql.put(MEMBERFIVE, member.toString());
		}
		if(list.get(15).get(8)!=null){
			Member member = new Member();
			member.setfId(poorId);
			member.setCoordinate("6"); 
			String name =list.get(19).get(6).toString().replace(" ", "");
			if(name.indexOf("姓名：") >= 0  && name.split("：").length > 1){
				member.setName(name.split("：")[1]);
			}else{
				member.setName("");
			} 
			 
			String age = list.get(20).get(6)==null?"":list.get(20).get(6).toString().replace(" ", "");
			if(age.indexOf("年龄：") >= 0  && age.split("：").length > 1){
				member.setAge(age.split("：")[1]);
			}else{
				member.setAge("");
			} 
			member.setSex(list.get(14).get(8)==null?"":list.get(14).get(8).toString().replace(" ", ""));
			member.setIdNo(list.get(15).get(8)==null?"":list.get(15).get(8).toString().replace(" ", ""));
			member.setRelationsh(list.get(16).get(8)==null?"":list.get(16).get(8).toString().replace(" ", ""));
			member.setNation(list.get(17).get(8)==null?"":list.get(17).get(8).toString().replace(" ", ""));
			member.setCulture(list.get(18).get(8)==null?"":list.get(18).get(8).toString().replace(" ", ""));
			member.setStudent(list.get(19).get(8)==null?"":list.get(19).get(8).toString().replace(" ", ""));
			member.setHealth(list.get(20).get(8)==null?"":list.get(20).get(8).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey6)){
				if(StringUtils.isBlank(fileNames.get(imgKey6))){
					member.setImg("");
				}else{
					member.setImg(fileNames.get(imgKey6));
				}  
			}
			sql.put(MEMBERSIX, member.toString());
		}
		
		poorFamliy.setAnalysePoorReason(list.get(21).get(1)==null?"":list.get(21).get(1).toString().replace(" ", ""));
		poorFamliy.setFamilySituation(list.get(22).get(1)==null?"":list.get(22).get(1).toString().replace(" ", ""));
		
		if(list.get(24).get(1)!=null){
			Education education = new Education();
			education.setfId(poorId);
			education.setCoordinate("1");
			education.setName(list.get(24).get(1).toString().replace(" ", ""));
			education.setSchool(list.get(24).get(2)==null?"":list.get(24).get(2).toString().replace(" ", ""));
			education.setEducation(list.get(24).get(4)==null?"":list.get(24).get(4).toString().replace(" ", ""));
			sql.put(EDUCATIONONE, education.toString());
		}
		if(list.get(25).get(1)!=null){
			Education education = new Education();
			education.setfId(poorId);
			education.setCoordinate("2");
			education.setName(list.get(25).get(1).toString().replace(" ", ""));
			education.setSchool(list.get(25).get(2)==null?"":list.get(25).get(2).toString().replace(" ", ""));
			education.setEducation(list.get(25).get(4)==null?"":list.get(25).get(4).toString().replace(" ", ""));
			sql.put(EDUCATIONTWO, education.toString());
		}
		if(list.get(26).get(1)!=null){
			Education education = new Education();
			education.setfId(poorId);
			education.setCoordinate("3");
			education.setName(list.get(26).get(1).toString().replace(" ", ""));
			education.setSchool(list.get(26).get(2)==null?"":list.get(26).get(2).toString().replace(" ", ""));
			education.setEducation(list.get(26).get(4)==null?"":list.get(26).get(4).toString().replace(" ", ""));
			sql.put(EDUCATIONTHREE, education.toString());
		}
		
		if(list.get(23).get(7)!=null){
			Industry industry = new Industry();
			industry.setfId(poorId);
			industry.setCoordinate("1");
			industry.setTitle(list.get(23).get(6).toString().replace(" ", ""));
			industry.setSubsidy(list.get(23).get(7)==null?"":list.get(23).get(7).toString().replace(" ", ""));
			sql.put(INDUSTRYONE, industry.toString());
		}
		if(list.get(24).get(7)!=null){
			Industry industry = new Industry();
			industry.setfId(poorId);
			industry.setCoordinate("2");
			industry.setTitle(list.get(23).get(6).toString().replace(" ", ""));
			industry.setSubsidy(list.get(24).get(7)==null?"":list.get(24).get(7).toString().replace(" ", ""));
			sql.put(INDUSTRYTWO, industry.toString());
		}
		if(list.get(25).get(7)!=null){
			Industry industry = new Industry();
			industry.setfId(poorId);
			industry.setCoordinate("3");
			industry.setTitle(list.get(23).get(6).toString().replace(" ", ""));
			industry.setSubsidy(list.get(25).get(7)==null?"":list.get(25).get(7).toString().replace(" ", ""));
			sql.put(INDUSTRYTHREE, industry.toString());
		}
		if(list.get(26).get(7)!=null){
			Industry industry = new Industry();
			industry.setfId(poorId);
			industry.setCoordinate("4");
			industry.setTitle(list.get(23).get(6).toString().replace(" ", ""));
			industry.setSubsidy(list.get(26).get(7)==null?"":list.get(26).get(7).toString().replace(" ", ""));
			sql.put(INDUSTRYFOUR, industry.toString());
		}
		 
		
		poorFamliy.setHouseArea(list.get(28).get(1)==null?"":list.get(28).get(1).toString().replace(" ", ""));
		poorFamliy.setHouseStructure(list.get(28).get(2)==null?"":list.get(28).get(2).toString().replace(" ", ""));
		poorFamliy.setHouseDanger(list.get(28).get(3)==null?"":list.get(28).get(3).toString().replace(" ", ""));
		poorFamliy.setHouseDangerLevel(list.get(30).get(1)==null?"":list.get(30).get(1).toString().replace(" ", ""));
		poorFamliy.setHouseRepairTime(list.get(30).get(2)==null?"":list.get(30).get(2).toString().replace(" ", ""));
		poorFamliy.setHouseRepairPrice(list.get(30).get(3)==null?"":list.get(30).get(3).toString().replace(" ", ""));
		if(fileNames.containsKey(imgKey7)){
			if(StringUtils.isBlank(fileNames.get(imgKey7))){
				poorFamliy.setHouseImgOne("");
			}else{
				poorFamliy.setHouseImgOne(fileNames.get(imgKey7));
			} 
			
		}
		if(fileNames.containsKey(imgKey8)){
			if(StringUtils.isBlank(fileNames.get(imgKey8))){
				poorFamliy.setHouseImgTwo("");
			}else{
				poorFamliy.setHouseImgTwo(fileNames.get(imgKey8));
			} 
		}
		
		if(list.get(32).get(1)!=null){
			Worker worker = new Worker();
			worker.setfId(poorId);
			worker.setCoordinate("1");
			worker.setName(list.get(32).get(1)==null?"":list.get(32).get(1).toString().replace(" ", ""));
			worker.setType(list.get(32).get(2)==null?"":list.get(32).get(2).toString().replace(" ", ""));
			worker.setIncome(list.get(32).get(3)==null?"":list.get(32).get(3).toString().replace(" ", ""));
			sql.put(WORKERONE, worker.toString());
		}
		if(list.get(33).get(1)!=null){
			Worker worker = new Worker();
			worker.setfId(poorId);
			worker.setCoordinate("2");
			worker.setName(list.get(33).get(1)==null?"":list.get(33).get(1).toString().replace(" ", ""));
			worker.setType(list.get(33).get(2)==null?"":list.get(33).get(2).toString().replace(" ", ""));
			worker.setIncome(list.get(33).get(3)==null?"":list.get(33).get(3).toString().replace(" ", ""));
			sql.put(WORKERTWO, worker.toString());
		}
		
		if(list.get(35).get(1)!=null){
			Medical medical = new Medical();
			medical.setfId(poorId);
			medical.setCoordinate("1");
			medical.setName(list.get(35).get(1).toString().replace(" ", ""));
			medical.setIllnessDescribe(list.get(35).get(2)==null?"":list.get(35).get(2).toString().replace(" ", ""));
			medical.setCureSituation(list.get(35).get(4)==null?"":list.get(35).get(4).toString().replace(" ", ""));
			medical.setHard(list.get(35).get(7)==null?"":list.get(35).get(7).toString().replace(" ", ""));
			sql.put(MEDICALONE, medical.toString());
		}
		if(list.get(36).get(1)!=null){
			Medical medical = new Medical();
			medical.setCoordinate("2");
			medical.setfId(poorId);
			medical.setName(list.get(36).get(1).toString().replace(" ", ""));
			medical.setIllnessDescribe(list.get(36).get(2)==null?"":list.get(36).get(2).toString().replace(" ", ""));
			medical.setCureSituation(list.get(36).get(4)==null?"":list.get(36).get(4).toString().replace(" ", ""));
			medical.setHard(list.get(36).get(7)==null?"":list.get(36).get(7).toString().replace(" ", ""));
			sql.put(MEDICALTWO, medical.toString());
		}
		if(list.get(37).get(1)!=null){
			Medical medical = new Medical();
			medical.setCoordinate("3");
			medical.setfId(poorId);
			medical.setName(list.get(37).get(1).toString().replace(" ", ""));
			medical.setIllnessDescribe(list.get(37).get(2)==null?"":list.get(37).get(2).toString().replace(" ", ""));
			medical.setCureSituation(list.get(37).get(4)==null?"":list.get(37).get(4).toString().replace(" ", ""));
			medical.setHard(list.get(37).get(7)==null?"":list.get(37).get(7).toString().replace(" ", ""));
			sql.put(MEDICALTHREE, medical.toString());
		}
		
		poorFamliy.setLeavePoorPlan(list.get(38).get(1)==null?"":list.get(38).get(1).toString().replace(" ", ""));
		poorFamliy.setIndustryHelp(list.get(41).get(1)==null?"":list.get(41).get(1).toString().replace(" ", ""));
		poorFamliy.setProjectFallback(list.get(41).get(4)==null?"":list.get(41).get(4).toString().replace(" ", ""));
		poorFamliy.setSocietyFallback(list.get(41).get(7)==null?"":list.get(41).get(7).toString().replace(" ", ""));
		
		
		if(list.get(43).get(2)!=null){
			Leader leader = new Leader();
			leader.setfId(poorId);
			leader.setCoordinate("1");
			leader.setName(list.get(43).get(2).toString().replace(" ", ""));
			leader.setSex(list.get(44).get(2)==null?"":list.get(44).get(2).toString().replace(" ", ""));
			leader.setDuties(list.get(45).get(2)==null?"":list.get(45).get(2).toString().replace(" ", ""));
			leader.setUnit(list.get(46).get(2)==null?"":list.get(46).get(2).toString().replace(" ", ""));
			leader.setMobile(list.get(47).get(2)==null?"":list.get(47).get(2).toString().replace(" ", ""));
			leader.setDutiesLevelName(list.get(48).get(0)==null?"":list.get(48).get(0).toString().replace(" ", ""));
			leader.setDutiesName(list.get(49).get(1)==null?"":list.get(49).get(1).toString().replace(" ", ""));
			leader.setDutiesMobile(list.get(50).get(1)==null?"":list.get(50).get(1).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey9)){
				if(StringUtils.isBlank(fileNames.get(imgKey9))){
					leader.setPicture("");
				}else{
					leader.setPicture(fileNames.get(imgKey9));
				}  
			}
			sql.put(LEADERONE, leader.toString());
		}
		if(list.get(43).get(5)!=null){
			Leader leader = new Leader();
			leader.setfId(poorId);
			leader.setCoordinate("2");
			leader.setName(list.get(43).get(5).toString().replace(" ", ""));
			leader.setSex(list.get(44).get(5)==null?"":list.get(44).get(5).toString().replace(" ", ""));
			leader.setDuties(list.get(45).get(5)==null?"":list.get(45).get(5).toString().replace(" ", ""));
			leader.setUnit(list.get(46).get(5)==null?"":list.get(46).get(5).toString().replace(" ", ""));
			leader.setMobile(list.get(47).get(5)==null?"":list.get(47).get(5).toString().replace(" ", ""));
			leader.setDutiesLevelName(list.get(48).get(3)==null?"":list.get(48).get(3).toString().replace(" ", ""));
			leader.setDutiesName(list.get(49).get(4)==null?"":list.get(49).get(4).toString().replace(" ", ""));
			leader.setDutiesMobile(list.get(50).get(4)==null?"":list.get(50).get(4).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey10)){
				if(StringUtils.isBlank(fileNames.get(imgKey10))){
					leader.setPicture(""); 
				}else{
					leader.setPicture(fileNames.get(imgKey10)); 
				}
			}
			sql.put(LEADERTWO, leader.toString());
		}
		if(list.get(43).get(8)!=null){
			Leader leader = new Leader();
			leader.setfId(poorId);
			leader.setCoordinate("3");
			leader.setName(list.get(43).get(8).toString().replace(" ", ""));
			leader.setSex(list.get(44).get(8)==null?"":list.get(44).get(8).toString().replace(" ", ""));
			leader.setDuties(list.get(45).get(8)==null?"":list.get(45).get(8).toString().replace(" ", ""));
			leader.setUnit(list.get(46).get(8)==null?"":list.get(46).get(8).toString().replace(" ", ""));
			leader.setMobile(list.get(47).get(8)==null?"":list.get(47).get(8).toString().replace(" ", ""));
			leader.setDutiesLevelName(list.get(48).get(6)==null?"":list.get(48).get(6).toString().replace(" ", ""));
			leader.setDutiesName(list.get(49).get(7)==null?"":list.get(49).get(7).toString().replace(" ", ""));
			leader.setDutiesMobile(list.get(50).get(7)==null?"":list.get(50).get(7).toString().replace(" ", ""));
			if(fileNames.containsKey(imgKey11)){
				if(StringUtils.isBlank(fileNames.get(imgKey11))){
					leader.setPicture("");
				}else{
					leader.setPicture(fileNames.get(imgKey11));
				} 
			}
			sql.put(LEADERTHREE, leader.toString());
		}
		String endTitle = list.get(51).get(0)==null?"":list.get(51).get(0).toString();
		poorFamliy.setEndTitle(endTitle);
		
		String[] endTitles = endTitle.split("："); 
		poorFamliy.setCreateUser(endTitles[1].replaceAll(" +",",").split(",")[1]);
		poorFamliy.setCreateTime(endTitles[2].replaceAll(" +",",").split(",")[0]);
		poorFamliy.setCreateUnit(endTitles[3].replaceAll(" +",",").split(",")[0]); 
		poorFamliy.setXianCode(xian);
		poorFamliy.setXiangCode(xiang);
		poorFamliy.setCunCode(cun);
		poorFamliy.setShiCode("150400000000");
		input.close();
		sql.put(FAMILY, poorFamliy.toString());
		return sql;
	}
}
